package cn.kgm.makeGodV2.ruleEngine;

/**
 * @Version 1.8
 * @Author: Kappi
 * @Date: 2025-9-24 17:53
 * @Description: cn.kgm.makeGodV2.ruleEngine.AndConditionRule
 */
public class AndConditionRule implements RuleStrategy<Boolean> {
    @Override
    public String getRuleType() {
        return "AND";
    }

    @Override
    public boolean validate(RuleContext context) {
        ConditionConfig conditionConfig = context.getParam("conditionConfig", ConditionConfig.class);
        return conditionConfig != null && conditionConfig.getConditions() != null;
    }

    @Override
    public RuleResult<Boolean> execute(RuleContext context) {
        ConditionConfig conditionConfig = context.getParam("conditionConfig", ConditionConfig.class);
        return ConditionExecutor.executeAndCondition(conditionConfig, context);
    }
}
